//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#include "OperandSolutionMap.h"

#include "OperandSolution.h"

using namespace std;

namespace Green {

    OperandSolutionMap::OperandSolutionMap()
      : mStorage()
    {
    }

    vector<pair<string, OperandSolution> >::iterator OperandSolutionMap::find(const string& k)
    {
        return find_if(mStorage.begin(), mStorage.end(),[k](const pair<string, OperandSolution>& entry)->bool{return k==entry.first;});
    }

    vector<pair<string, OperandSolution> >::iterator OperandSolutionMap::end()
    {
        vector<pair<string, OperandSolution> >::iterator it = mStorage.end();
        return it;
    }

    vector<pair<string, OperandSolution> >::const_iterator OperandSolutionMap::end() const
    {
        vector<pair<string, OperandSolution> >::const_iterator it = mStorage.end();
        return it;
    }

    vector<pair<string, OperandSolution> >::iterator OperandSolutionMap::begin()
    {
        vector<pair<string, OperandSolution> >::iterator it = mStorage.begin();
        return it;
    }

    vector<pair<string, OperandSolution> >::const_iterator OperandSolutionMap::begin() const
    {
        vector<pair<string, OperandSolution> >::const_iterator it = mStorage.begin();
        return it;
    }

    size_t OperandSolutionMap::size() const {

      return mStorage.size();
    }

    void OperandSolutionMap::emplace(const string& k, OperandSolution&& ropr_sol)
    {
        mStorage.emplace(mStorage.end(), make_pair(k, move(ropr_sol)));
    }
}

